package com.qys.livesMall.shop.controller.app;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qys.livesMall.app.user.model.dto.AppBaseDTO;
import com.qys.livesMall.app.user.model.dto.app.AppUserInfoTeamIncomeDTO;
import com.qys.livesMall.finance.model.vo.AppUserInfoTeamIncomeVO;
import com.qys.livesMall.framework.view.BaseQuery;
import com.qys.livesMall.shop.modal.vo.AppShopInfoTeamVo;
import com.qys.livesMall.app.user.model.vo.app.AppUserInfoTeamDetailVo;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.framework.utils.SecurityUtils;
import com.qys.livesMall.shop.service.ShopStatisticsTeamService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 团队统计数据 前端控制器
 * </p>
 *
 * @author
 * @since 2023-08-02
 */
@RestController
@RequestMapping("/app/shopStatisticsTeam")
@Tag(name = "店铺团队信息", description = "店铺团队信息")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppShopStatisticsTeamController {

    private final ShopStatisticsTeamService shopStatisticsTeamService;

    @GetMapping("/getShopTeam")
    @Operation(summary = "店铺团队信息")
    public R<AppShopInfoTeamVo> getShopTeam(){
        return R.ok(shopStatisticsTeamService.getShopTeam(SecurityUtils.getUserId()));
    }

    @PostMapping("/page/getUserShoplist")
    @Operation(summary = "查询店铺团用户列表")
    public R<Page<AppUserInfoTeamDetailVo>> getUserShoplist(@RequestBody BaseQuery baseQuery) {
        return R.ok(shopStatisticsTeamService.getUserShoplist(baseQuery));
    }

    @PostMapping("/getShoplistIncome")
    @Operation(summary = "查询店铺团收益列表")
    public R<Page<AppUserInfoTeamIncomeVO>> getShoplistIncome(@RequestBody AppUserInfoTeamIncomeDTO incomeDTO) {
        return R.ok(shopStatisticsTeamService.getShoplistIncome(incomeDTO));
    }
}
